
//var remote = "http://127.0.0.1:5555";
var remote = "https://api.hackerstack.top"

function send_mail() {
    var target = document.getElementById('send_to').value;
    var title = document.getElementById('title').value;
    var content = document.getElementById('content').value;

    var json = JSON.parse(document.cookie);
    var user = json.user;
    var pwd = json.pwd;

    var xhr = new XMLHttpRequest();
    xhr.open('POST' , remote + "/send_mail/" +user+"/"+pwd+"/" , true);
    var json_obj = {
        "send_to" : target,
        "title" : title,
        "content" : content
    }
    xhr.send(JSON.stringify(json_obj))
    xhr.onload = function() {
        showAlert(xhr.responseText , null);
    }
}